print("Example script lr_shengcun.lua.");

----------------------------------------
local ShouWangScheme = CLASS(Scheme)
function ShouWangScheme:ctor( )
end

local function fanzhi( )
	-- body
	local usable, nomana = IsUsableSpell('反制射击')
	local start, duration, enabled = GetSpellCooldown('反制射击')
	-- print(usable, start)
	if not usable or start ~= 0 then
		return false
	end

	if interruptJudge('target') then
		ut.cast('反制射击', 'target')
		return true
	end

	for i=1, 5 do
		local t = 'arena' .. i
		if UnitExists(t) then
			if interruptJudge(t) then
				ut.cast('反制射击',t)
				return true
			end
		else 
			break
		end
	end
end
function ShouWangScheme:update( )
	local t = 'target'
	if not UnitExists(t) or UnitIsFriend('player', t) then
		return
	end

	if UnitCastingInfo('player') then
		return
	end
	
	ut.cast('杀戮命令', t)
	ut.cast('夺命射击', t)

	fanzhi()


	do
		local ret = foreachBuff(t, function( name, debuffType )
			return debuffType == 'Magic'
		end)
		if UnitIsPlayer(t) and ret then
			ut.cast('宁神射击', t)
		end
	end

	if not immune_slowdown(t) and UnitIsPlayer(t) and GetUnitSpeed(t) >= 0 then
		ut.cast('震荡射击', t)
	end

	if UnitDebuff("pet", 1) and not UnitBuff('pet', '治疗宠物') then
		ut.cast('治疗宠物', 'pet')
	end

	if UnitIsPlayer(t) then
		ut.cast('夺命黑鸦', t)
	end

	ut.cast('凶暴野兽', t)

	if UnitIsPlayer(t) or 1 then
		ut.cast('飞刃', t)
	end

	local _, count = getBuffRemianTime('player', '狂乱')
	if count >= 5 then
		ut.cast('集中火力')
	end


    if UnitBuff('player', '狩猎刺激') or UnitPower('player') > 70 then
    	ut.cast('奥术射击', t)
    end

    ut.cast('眼镜蛇射击', t)
end

function ShouWangScheme:baozha0( )
	-- body
	stop()
	ut.cast('爆炸陷阱')
	if UnitExists('target') then
		CastAtPosition(GetPositionBetweenObjects('player', 'target', 5))
	else
		CastAtPosition(ObjectPosition('player'))
	end

end
function ShouWangScheme:bingdong0( )
	-- body
	stop()
	ut.cast('冰冻陷阱')
	if UnitExists('target') then
		CastAtPosition(GetPositionBetweenObjects('player', 'target', 5))
	else
		CastAtPosition(ObjectPosition('player'))
	end
end
function ShouWangScheme:bingdong1( )
	-- body
	stop()
	ut.cast('冰冻陷阱')

	local t = PVPOther()
	if UnitExists(t) then
		CastAtPosition(ObjectPosition(t))
	else
		CastAtPosition(ObjectPosition('player'))
	end
end
schemeMap[31] = ShouWangScheme.new()








